module Helper where
import System.FilePath ((</>))
import Text.Regex


extractConfigPath :: [String] -> (Maybe String, [String])
extractConfigPath (a : as) = case matchRegex pattern a of
        Just [path] -> (Just path, as)
        Nothing     -> (Nothing, a : as)
extractConfigPath args  = (Nothing, args)

pattern = mkRegex "--config=(.*)"

dos2unix :: String -> String
dos2unix = filter (/= '\r')
